/**
 * Created by ACER on 2017/4/16.
 */
app.controller('tel-get-back',function($scope,$http){
    //用户名
    $scope.telPhone = '';
    //用户新密码
    $scope.newpassword = '';
    $scope.forgetTelPassword = function(){
        var registerInfo = {'telPhone':$scope.telPhone,'newpassword':$scope.newpassword};
        $http({
            method:'post',
            url:app.netPath+'/users/resetPasswordByTelPhone',
            params:registerInfo
        }).then(function(res){
            console.log('hello');
            if(!res.data.error){
                $.alert('修改成功')
            }else{
                var errorCode=res.data.error;
                switch (errorCode){
                    case  101:
                        $.alert( '请输入用户名和密码和验证码');
                        return;
                    case 201:
                        $.alert('该用户还没注册');
                        return ;
                    case 202:
                        $.alert( '重置失败，请重试');
                        return;
                }
            }
        },function(res){
            console.log(res);
            $.alert('网络走丢了');
        })
    }

});